﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
using System.Windows.Markup;

namespace WOWA.Utility
{
	public static class ResourceUtility
	{
		public static ResourceDictionary GetResourceDictionary(string path)
		{
			return XamlReader.Load(GetTextContent(path)) as ResourceDictionary;
		}

		public static string GetTextContent(string path)
		{
			var info = Application.GetResourceStream(new Uri(path, UriKind.Relative));
			if (info == null || info.Stream == null)
			{
				return null;
			}

			StreamReader reader = new StreamReader(info.Stream);
			string content = reader.ReadToEnd();

			reader.Close();

			return content;
		}
	}
}
